package com.demo.index;

import com.demo.common.model.Goods;
import com.demo.goods.GoodService;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Page;

/**
 * 商品控制层
 *
 * @auther TyCoding
 * @date 2018/10/6
 */
public class GoodsController extends Controller {

    static GoodService service = new GoodService();


    public void index() {
        System.out.println("1");
        render("pages/index.jsp");

    }


    public void findByPage() {
        int pageSize = getParaToInt("pageSize",10);
        int pageNum = getParaToInt("pageNum",1);
        String name = getPara("name");

        Page<Goods> goodsPage= service.findByPage(pageNum,pageSize,name);
        renderJson(goodsPage);
    }


}
